import request from '@/utils/request';
import type { skuResponseData, skuDetailResponseData } from './type';
enum API {
    // 获取已有的商品数据
    SKU_URL = '/admin/product/list',
    // 商品下架
    SKU_UNDERCARRIAG_URL = '/admin/product/cancelSale',
    // 商品上架
    SKU_ON_CARRIAGE_URL = '/admin/product/onSale',
    // 获取商品详情
    SKUINFO_URL = '/admin/product/getSkuInfo',
    // 删除商品
    SKU_DELETE_URL = '/admin/product/deleteSku',
}
export const reqSkuList = (page: number, limit: number) =>
    request.get<any, skuResponseData>(API.SKU_URL + `/${page}/${limit}`);

// 商品上架
export const reqOnSale = (skuId: number) =>
    request.get<any, any>(API.SKU_ON_CARRIAGE_URL + `/${skuId}`);

// 商品下架
export const reqCancelSale = (skuId: number) =>
    request.get<any, any>(API.SKU_UNDERCARRIAG_URL + `/${skuId}`);
// 获取商品详情
export const reqSkuInfo = (skuId: number) =>
    request.get<any, skuDetailResponseData>(API.SKUINFO_URL + `/${skuId}`);
// 删除商品
export const reqDeleteSku = (skuId: number) =>
    request.delete<any, any>(API.SKU_DELETE_URL + `/${skuId}`);
